<template>
	<view class="container">
		<!-- 用户信息区域 -->
		<view class="user-header">
			<text class="page-title">个人中心</text>
			<view class="user-info">
				<image class="avatar" src="https://images.unsplash.com/photo-1494790108377-be9c29b29330" mode="aspectFill"></image>
				<view class="user-detail">
					<text class="username">梦想家</text>
					<text class="user-level">普通会员</text>
				</view>
			</view>
		</view>
		
		<!-- 数据统计 -->
		<view class="stats-card">
			<view class="stat-item" @click="switchTab('/pages/history/history')">
				<text class="stat-num">12</text>
				<text class="stat-label">已解梦</text>
			</view>
			<view class="stat-item">
				<text class="stat-num">3</text>
				<text class="stat-label">剩余次数</text>
			</view>
			<view class="stat-item" @click="navigateTo('/pages/favorite/favorite')">
				<text class="stat-num">5</text>
				<text class="stat-label">收藏</text>
			</view>
		</view>
		
		<!-- 功能列表 -->
		<view class="function-group">
			<view class="function-item" @click="navigateTo('/pages/vip/vip')">
				<view class="item-left">
					<text class="item-icon">💎</text>
					<text class="item-title">开通会员</text>
				</view>
				<text class="item-arrow">></text>
			</view>
			<view class="function-item" @click="handleShare">
				<view class="item-left">
					<text class="item-icon">🎁</text>
					<text class="item-title">邀请好友</text>
				</view>
				<text class="item-arrow">></text>
			</view>
		</view>
		
		<view class="function-group">
			<view class="function-item" @click="navigateTo('/pages/dream-report/dream-report')">
				<view class="item-left">
					<text class="item-icon">📊</text>
					<text class="item-title">梦境报告</text>
				</view>
				<text class="item-arrow">></text>
			</view>
			<view class="function-item" @click="handleHelp">
				<view class="item-left">
					<text class="item-icon">❓</text>
					<text class="item-title">帮助与反馈</text>
				</view>
				<text class="item-arrow">></text>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			
		}
	},
	methods: {
		navigateTo(url) {
			uni.navigateTo({ url })
		},
		switchTab(url) {
			uni.switchTab({ url })
		},
		handleShare() {
			uni.share({
				provider: "weixin",
				scene: "WXSceneSession",
				type: 0,
				title: "AI解梦 - 揭开你的梦境奥秘",
				summary: "快来体验AI解梦，揭开你的梦境奥秘",
				imageUrl: '/static/share-img.png',
				success: function (res) {
					console.log("success:" + JSON.stringify(res));
				},
				fail: function (err) {
					console.log("fail:" + JSON.stringify(err));
				}
			})
		},
		handleHelp() {
			uni.showToast({
				title: '帮助功能开发中',
				icon: 'none'
			})
		}
	}
}
</script>

<style>
.container {
	min-height: 100vh;
	background: #f5f5f5;
}

.user-header {
	background: #4080ff;
	padding: 30rpx;
	padding-bottom: 100rpx;
	border-radius: 0 0 40rpx 40rpx;
}

.page-title {
	font-size: 36rpx;
	color: #fff;
	font-weight: bold;
	margin-bottom: 30rpx;
	display: block;
}

.user-info {
	display: flex;
	align-items: center;
}

.avatar {
	width: 120rpx;
	height: 120rpx;
	border-radius: 60rpx;
	border: 4rpx solid #fff;
}

.user-detail {
	margin-left: 20rpx;
}

.username {
	font-size: 32rpx;
	color: #fff;
	font-weight: 500;
	margin-bottom: 8rpx;
	display: block;
}

.user-level {
	font-size: 24rpx;
	color: rgba(255,255,255,0.8);
}

.stats-card {
	margin: -60rpx 30rpx 30rpx;
	background: #fff;
	border-radius: 20rpx;
	padding: 30rpx;
	display: flex;
	justify-content: space-around;
	box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.1);
}

.stat-item {
	text-align: center;
}

.stat-num {
	font-size: 40rpx;
	color: #4080ff;
	font-weight: bold;
	margin-bottom: 8rpx;
	display: block;
}

.stat-label {
	font-size: 24rpx;
	color: #999;
}

.function-group {
	margin: 30rpx;
	background: #fff;
	border-radius: 20rpx;
}

.function-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 30rpx;
	border-bottom: 1rpx solid #f5f5f5;
}

.function-item:last-child {
	border-bottom: none;
}

.item-left {
	display: flex;
	align-items: center;
}

.item-icon {
	font-size: 40rpx;
	margin-right: 20rpx;
}

.item-title {
	font-size: 28rpx;
	color: #333;
}

.item-arrow {
	font-size: 28rpx;
	color: #999;
}
</style> 